This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
I think this is a great approach since it isolates the validation to the button action.
When looking at this this weekend I believe there is an issue with the timing of setting the sessionScope variable.
By the time the button action fires off, the validation phase has already occurred. So the sessionScope variable does not get set in time for the validation phase (here's a link to the JSF lifecycle phases: http://www.ibm.com/developerworks/library/j-jsf2/basic-lifecycle.gif). Therefore it does not validate the fields.
Can you check to see if you see the same behavior the first time the button is clicked?
I tried to fire off an error in the code, but it comes back to the timing. If you set the field to be required via server side script, the XPage needs to be reloaded for that to be in affect.
By accessing the component (JSF), you can manipulate the properties directly:
tmp=getComponent("SKU1"); //get input control
//some if statement goes here
tmp.setValid(false);
tmp.setRequired(true);
return;
But... once it is loaded and is required, you have the issue with the pager again.
I was looking into adding a message via script by using facesContext.addMessage() and just performing the validation logic manually but having the messages control display the error message with any other errors. I'm having trouble with accessing the right classes for this. I am still looking into it....
John
Feedback response number WEBB7P3NNL created by ~Ethan Umresaakol on 02/08/2009